package cn.daniellee.plugin.otp.listener;

import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;

public class PlayerListener implements Listener {

	@EventHandler
	public void onPlayerCommand(PlayerCommandPreprocessEvent e) {
		String lowerMessage = e.getMessage().toLowerCase();
		if(lowerMessage.startsWith("/tpa") || lowerMessage.equals("/tpa")) {
			e.setMessage(lowerMessage.replace("/tpa", "/otpa"));
		} else if(lowerMessage.startsWith("/tpahere") || lowerMessage.equals("/tpahere")) {
			e.setMessage(lowerMessage.replace("/tpahere", "/otpahere"));
		} else if(lowerMessage.startsWith("/tpaccept") || lowerMessage.equalsIgnoreCase("/tpaccept")) {
			e.setMessage(lowerMessage.replace("/tpaccept", "/otpaccept"));
		} else if(lowerMessage.startsWith("/tpdeny") || lowerMessage.equalsIgnoreCase("/tpdeny")) {
			e.setMessage(lowerMessage.replace("/tpdeny", "/otpdeny"));
		}
	}

}
